import request from '@/utils/axios'

export type NoticeType = {
  id: number | undefined
  title: string
  type: number
  content: string
  status: number
  remark: string
  create_time?: Date
}

export interface NoticePageReqType extends PageParam {
  title?: string
  status?: number
}

/**
 * 通知公告接口
 */
export const NoticeApi = {
  // 新增
  create: (data: NoticeType) => {
    return request.post({ url: '/system/notice/create', data, is_mock: true })
  },
  // 修改
  update: (data: NoticeType) => {
    return request.put({ url: '/system/notice/update', data, is_mock: true })
  },
  // 删除
  delete: (id: number) => {
    return request.delete({ url: '/system/notice/delete?id=' + id, is_mock: true })
  },
  // 查询详情
  detail: (id: number) => {
    return request.get({ url: '/system/notice/detail?id=' + id, is_mock: true })
  },
  // 查询分页列表
  page: (params: NoticePageReqType) => {
    return request.get({ url: '/system/notice/page', params, is_mock: true })
  },
  // 推送公告
  push: (id: number) => {
    return request.post({ url: '/system/notice/push?id=' + id, is_mock: true })
  }
}
